﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace movie.tool.module.film.ui
{
    public class StringArrayStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null)
            {
                return "";
            }
            return string.Join(" ",(string[]) value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null)
            {
                return new string[0];
            }
            return value.ToString().Split(" ");
        }
    }
}
